Page({
  data: {},
  onLoad() {},

 upld:function(){


dd.chooseImage({ //请求图片

count: 1,  //上传图片张数限制 

success: (res) => {

console.log("返回的文件信息为:");

console.log(res);

var filePaths = res.filePaths;

dd.getAuthCode({

success: function(res) {

console.log('filePath的值为:');

console.log(filePaths);

var authCode = res.authCode;

dd.uploadFile({

url: 'http://ding.tida-lighting.com/api/user/upload_image',
           filePath: filePaths[0],
             fileType: 'image',
             fileName: 'img',
            formData: { 'year': '2020',
                  'month':'4',
                  'staffid':'035149',
      
           },




success: (res) => {

var data = JSON.parse(res.data);

console.log("转换后的data为:");

console.log(data);

var img_url = data.data.img_url;

that.data.actImg = img_url;

that.data.isUp = 1; //同时将是否已经上传改为是

console.log('图片信息为:');

console.log(that.data.actImg);

that.setData({

coverImg: that.data.actImg,

isUp: 1

})

},

fail: function(res) {

dd.showToast({

content: '上传信息失败',

type: 'fail',

});

},

});

},

fail: function(res) {

dd.showToast({

content: '获取用户权限信息失败',

type: 'fail',

});

}

})

},

});



 }



});
